package com.stony.orc;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collector;
import java.util.stream.Collectors;

/**
 * <p>orcTest
 * <p>com.stony.orc
 *
 * @author stony
 * @version 下午6:41
 * @since 2017/11/16
 */
public class TonicRecord {
    @JsonProperty("visit_id")
    long visitId;
    @JsonProperty("tonic_name")
    String tonicName;
    @JsonProperty("tonic_weight")
    BigDecimal tonicWeight;

    public Tonic toTonic() {
        return new Tonic(tonicName, tonicWeight.doubleValue());
    }
    public long getVisitId() {
        return visitId;
    }

    public void setVisitId(long visitId) {
        this.visitId = visitId;
    }

    public String getTonicName() {
        return tonicName;
    }

    public void setTonicName(String tonicName) {
        this.tonicName = tonicName;
    }

    public BigDecimal getTonicWeight() {
        return tonicWeight;
    }

    public void setTonicWeight(BigDecimal tonicWeight) {
        this.tonicWeight = tonicWeight;
    }
    public static List<Tonic> toTonicList(List<TonicRecord> records) {
        return records.stream().map(TonicRecord::toTonic).collect(Collectors.toList());
    }
}
